package com.cntaiping.workutil.ocr;

import lombok.Data;

import java.util.HashMap;

/**
 * @author Fei
 * @Date 2021-4-12
 *
 */
@Data
public class TicketResponse extends HashMap<String, Object> {
    private static final long serialVersionUID = -8713837118340960775L;

    public TicketResponse code(String code) {
        this.put("code", code);
        return this;
    }

    public TicketResponse message(String message) {
        this.put("message", message);
        return this;
    }

    public TicketResponse data(Object data) {
        this.put("data", data);
        return this;
    }

    public TicketResponse success() {
        this.code("0000");
        this.message("success");
        return this;
    }

    public TicketResponse success(Object data) {
        this.code("0000");
        this.message("success");
        this.data(data);
        return this;
    }

    public TicketResponse fail() {
        this.code("9999");
        this.message("failed");
        return this;
    }

    public TicketResponse fail(String message) {
        this.code("9999");
        this.message(message);
        return this;
    }

    @Override
    public TicketResponse put(String key, Object value) {
        super.put(key, value);
        return this;
    }
}
